package com.lhkj.ct.meta.modules.scheduling.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lhkj.ct.base.model.dto.PageQuery;
import com.lhkj.ct.meta.modules.scheduling.model.entity.TblScheAppoint;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 预约记录表 Mapper 接口
 * </p>
 *
 * @author jobob
 * @since 2023-10-29
 */
public interface ScheAppointMapper extends BaseMapper<TblScheAppoint> {

    IPage<TblScheAppoint> selectAppointPage(Page<TblScheAppoint> page,
                                            @Param("appoint") TblScheAppoint appoint,
                                            @Param("pageQuery") PageQuery pageQuery);

    IPage<TblScheAppoint> selectAppointPageByPatient(Page<TblScheAppoint> page,
                                            @Param("appoint") TblScheAppoint appoint,
                                            @Param("pageQuery") PageQuery pageQuery);

    @Select("select t.id, t.status, t.pat_id, t1.sche_date, t1.start_time, t1.end_time from tbl_sche_appoint t " +
            "left join tbl_scheduling t1 on t1.id = t.sche_id " +
            "where t.id = #{id,jdbcType=VARCHAR}")
    TblScheAppoint getWithScheduling(String id);
}
